package com.thinkingstar.iads.common.enums;

import org.nutz.lang.Lang;

import java.util.LinkedList;
import java.util.List;

public enum  DesignContentsLibrary {

    /** =================================  设计类别   ===================================== ***/
    铁路("01","","铁路","大铁","","railway"),
    城市轨道交通("02","","城轨","轨道交通","","subway"),
    公路市政("03","","公路市政","市政","","municipal "),


    /*** +++++++++++++++++++++++++++++++++++++ 设计专业  +++++++++++++++++++++++++++++++++++ ***/
    /** "铁路"科类下的专业  */
    总体_铁路("010","01","总体","总","无","total"),
    经调_铁路("011","01","经调","经","经济与运量国名经济评价","economic"),
    行车_铁路("012","01","行车","行","运输组织、资金筹措、财务评价","driving"),
    线路_铁路("013","01","线路","线","线路、土地利用","line"),
    轨道_铁路("014","01","轨道","轨","轨道","track"),
    站场_铁路("015","01","站场","站","站场","station"),
    桥梁_铁路("016","01","桥梁","桥","桥梁、涵洞","bridge"),
    地路_铁路("017","01","地路","路","地质、路基","subgrade"),
    隧道_铁路("018","01","隧道","隧","隧道、地道","tunnel"),
    建筑_铁路("019","01","建筑","建","建筑","building"),
    结构_铁路("0110","01","结构","结","结构","structure"),
    暖通_铁路("0111","01","暖通","暖","暖通空调卫生设备、隧道通风机械设施","havc"),
    机辆_铁路("0112","01","机辆","辆","机务设备、动车组设备、车辆设备","vehicle"),
    机械_铁路("0113","01","机械","机","综合检测与维修、工务有关设施、客货运机械设备及其他","machine"),
    通信_铁路("0114","01","通信","通","通信","communication"),
    信息_铁路("0115","01","信息","信","信息","information"),
    信号_铁路("0116","01","信号","信","信号、防灾安全监控","signal"),
    电力_铁路("0117","01","电力","电","电力","power"),
    供变电_铁路("0118","01","供变电","供","牵引供电系统、牵引变电所、开闭所、分区所、AT所及电力调度所、维护管理、受电气化影响的电力线路的处理","powersupply"),
    触控网_铁路("0119","01","触控网","网","接触网","touchscreen"),
    通信防护_铁路("0120","01","通信防护","护","电磁干扰防护","communicationprotection"),
    给排水_铁路("0121","01","给排水","给排水","给排水","watersupp"),
    环保_铁路("0122","01","环保","环","环境保护、水土保持、节约能源","environmentalprotection"),
    工经_铁路("0123","01","工经","工","概预算、施工组织、重点大型临时工程","afterwork"),

    /* "城市轨道交通"  大类 下的专业 */
    经调_城轨交通("021","02","经调","经","经济与运量国名经济评价","economic"),
    行车_城轨交通("022","02","行车","行","运输组织、资金筹措、财务评价","driving"),
    轨道_城轨交通("024","02","轨道","轨","轨道","track"),
    桥梁_城轨交通("026","02","桥梁","桥","桥梁、涵洞","bridge"),
    地路_城轨交通("027","02","地路","路","地质、路基","subgrade"),
    隧道_城轨交通("028","02","隧道","隧","隧道、地道","tunnel"),
    建筑_城轨交通("029","02","建筑","建","建筑","building"),
    结构_城轨交通("0210","02","结构","结","结构","structure"),
    暖通_城轨交通("0211","02","暖通","暖","暖通空调卫生设备、隧道通风机械设施","havc"),
    机辆_城轨交通("0212","02","机辆","辆","机务设备、动车组设备、车辆设备","vehicle"),
    机械_城轨交通("0213","02","机械","机","综合检测与维修、工务有关设施、客货运机械设备及其他","machine"),
    通信_城轨交通("0214","02","通信","通","通信","communication"),
    信息_城轨交通("0215","02","信息","信","信息","information"),
    信号_城轨交通("0216","02","信号","信","信号、防灾安全监控","signal"),
    电力_城轨交通("0217","02","电力","电","电力","power"),
    供变电_城轨交通("0218","02","供变电","供","牵引供电系统、牵引变电所、开闭所、分区所、AT所及电力调度所、维护管理、受电气化影响的电力线路的处理","powersupply"),
    触控网_城轨交通("0219","02","触控网","网","接触网","touchscreen"),
    给排水_城轨交通("0221","02","给排水","给排水","给排水","watersupp"),
    环保_城轨交通("0222","02","环保","环","环境保护、水土保持、节约能源","environmentalprotection"),
    工经_城轨交通("0223","02","工经","工","概预算、施工组织、重点大型临时工程","afterwork"),
    线站_城轨交通("0226","02","线站","线","路线、站场","linestation"),

    /* "公路市政"  大类 下的专业   */
    经调_公路市政("031","03","经调","经","经济与运量国名经济评价","economic"),
    地路_公路市政("037","03","地路","路","地质、路基","subgrade"),
    桥梁_公路市政("036","03","桥梁","桥","桥梁、涵洞","bridge"),
    隧道_公路市政("038","03","隧道","隧","隧道、地道","tunnel"),
    房建_公路市政("0324","03","房建","房","房屋建筑","housingconstruction"),
    暖通_公路市政("0311","03","暖通","暖","暖通空调卫生设备、隧道通风机械设施","havc"),
    通信_公路市政("0314","03","通信","通","通信","communication"),
    信号_公路市政("0316","03","信号","信","信号、防灾安全监控","signal"),
    电力_公路市政("0317","03","电力","电","电力","power"),
    给排水_公路市政("0321","03","给排水","给排水","给排水","watersupp"),
    环保_公路市政("0322","03","环保","环","环境保护、水土保持、节约能源","environmentalprotection"),
    工经_公路市政("0323","03","工经","工","概预算、施工组织、重点大型临时工程","afterwork"),
    路线_公路市政("0325","03","路线","线","路线、路线交叉、交通安全设施","route"),
    交通工程_公路市政("0327","03","交通工程","交","交通工程","trafficengineering"),

    /*** ##################################  设计内容     ##############################+ ***/

    /* 机械专业下的设计内容  */
    /* 1-13 即  ‘铁道’ 设计科类  ‘机械’ 设计专业 */
    防护门("01131","0113","防护门","防护门","防护门","trafficengineering"),
    客货运机械("01132","0113","客货运机械","客货运","交通工程","trafficengineering"),
    高铁综合维修("01133","0113","高铁综合维修","高铁维修","客货运机械","trafficengineering"),
    驼峰机械设备("01134","0113","驼峰机械设备","驼峰机械","驼峰机械设备","trafficengineering");


    /** 记录编号 */
    private final String  code ;
    /** 父项编号    */
    private final String  pid ;
    /** 中文名称    */
    private final String  name ;
    /** 缩写   */
    private final String  abbreviation ;
    /** 内容   */
    private final String  content ;
    /** 英文名   */
    private final String  englishName;

    DesignContentsLibrary(String code, String pid, String name, String abbreviation, String content, String englishName) {
        this.code = code;
        this.pid= pid ;
        this.name  = name ;
        this.abbreviation = abbreviation;
        this.content  = content ;
        this.englishName = englishName;
    }

    /**
     * @Title: all
     * @Description: 返回所有设计类别
     */
    public static List<DesignContentsLibrary>  finAllCategorys(){
        List<DesignContentsLibrary> categoryLs = new LinkedList<>();
        categoryLs.add(铁路);
        categoryLs.add(城市轨道交通);
        categoryLs.add(公路市政);
        return  categoryLs ;
    }

    /**
     * @Title: all
     * @Description: 返回所有设计专业
     */
    public static List<DesignContentsLibrary> finAllSpecialitys(){
        List<DesignContentsLibrary> specialitysLs = new LinkedList<>();

        /* "铁路"  大类 下的专业 */
        specialitysLs.add(总体_铁路);
        specialitysLs.add(经调_铁路);
        specialitysLs.add(行车_铁路);
        specialitysLs.add(线路_铁路);
        specialitysLs.add(轨道_铁路);
        specialitysLs.add(站场_铁路);
        specialitysLs.add(桥梁_铁路);
        specialitysLs.add(地路_铁路);
        specialitysLs.add(隧道_铁路);
        specialitysLs.add(建筑_铁路);
        specialitysLs.add(结构_铁路);
        specialitysLs.add(暖通_铁路);
        specialitysLs.add(机辆_铁路);
        specialitysLs.add(机械_铁路);
        specialitysLs.add(通信_铁路);
        specialitysLs.add(信息_铁路);
        specialitysLs.add(信号_铁路);
        specialitysLs.add(电力_铁路);
        specialitysLs.add(供变电_铁路);
        specialitysLs.add(触控网_铁路);
        specialitysLs.add(通信防护_铁路);
        specialitysLs.add(给排水_铁路);
        specialitysLs.add(环保_铁路);
        specialitysLs.add(工经_铁路);

        /* "城市轨道交通"  大类 下的专业 */
        specialitysLs.add(经调_城轨交通);
        specialitysLs.add(行车_城轨交通);
        specialitysLs.add(轨道_城轨交通);
        specialitysLs.add(桥梁_城轨交通);
        specialitysLs.add(地路_城轨交通);
        specialitysLs.add(隧道_城轨交通);
        specialitysLs.add(建筑_城轨交通);
        specialitysLs.add(结构_城轨交通);
        specialitysLs.add(暖通_城轨交通);
        specialitysLs.add(机辆_城轨交通);
        specialitysLs.add(机械_城轨交通);
        specialitysLs.add(通信_城轨交通);
        specialitysLs.add(信息_城轨交通);
        specialitysLs.add(信号_城轨交通);
        specialitysLs.add(电力_城轨交通);
        specialitysLs.add(供变电_城轨交通);
        specialitysLs.add(触控网_城轨交通);
        specialitysLs.add(给排水_城轨交通);
        specialitysLs.add(环保_城轨交通);
        specialitysLs.add(工经_城轨交通);
        specialitysLs.add(线站_城轨交通);

        /* "公路市政"  大类 下的专业   */
        specialitysLs.add( 经调_公路市政);
        specialitysLs.add(地路_公路市政);
        specialitysLs.add(桥梁_公路市政);
        specialitysLs.add(隧道_公路市政);
        specialitysLs.add(房建_公路市政);
        specialitysLs.add(暖通_公路市政);
        specialitysLs.add(通信_公路市政);
        specialitysLs.add(信号_公路市政);
        specialitysLs.add(电力_公路市政);
        specialitysLs.add(给排水_公路市政);
        specialitysLs.add(环保_公路市政);
        specialitysLs.add(工经_公路市政);
        specialitysLs.add( 路线_公路市政);
        specialitysLs.add(交通工程_公路市政);
        return  specialitysLs ;
    }

    /**
     * @Title: all
     * @Description: 返回所有设计内容
     */
    public static List<DesignContentsLibrary>  finAllItems(){
        List<DesignContentsLibrary> itemLs =  new LinkedList<>();
        itemLs.add(防护门);
        itemLs.add(客货运机械);
        itemLs.add(高铁综合维修);
        itemLs.add(驼峰机械设备);
        return  itemLs ;
    }


    /**
     * 根据设计类别ID 返回下属的专业
     * @param desc
     * @return
     */
    public static List<DesignContentsLibrary> findSpecialitysByCategoryID(String pid){
        List<DesignContentsLibrary> specialitysLs = finAllSpecialitys();

        for (DesignContentsLibrary speciality : specialitysLs) {
            if(! Lang.equals(pid, speciality.getPid())){
                specialitysLs.remove(speciality) ;
            }
        }
        return specialitysLs;
    }

    /**
     * 根据设计专业返回   下属的设计内容
     * @param code
     * @return
     */
    public static List<DesignContentsLibrary>   findItemsBySpeciality(DesignContentsLibrary speciality){
        List<DesignContentsLibrary> itemLs  = finAllItems() ;

        /*
         * Example :
         * 专业：              机械_铁路("13","1","机械","机","综合检测与维修、工务有关设施、客货运机械设备及其他","machine"),
         * 设计内容:   防护门("1","1-13","防护门","防护门","防护门","trafficengineering")
         *
         */
        for (DesignContentsLibrary item : itemLs) {
            if((! Lang.equals(speciality.getPid()+"－"+speciality.getCode(), item.getPid()))){
                itemLs.remove(item) ;
            }
        }
        return itemLs;
    }



    /**
     * 根据设计类别ID及设计专业ID返回特定专业  返回下属的专业
     * @param desc
     * @return
     */
    public static DesignContentsLibrary findSpeciality(String code , String pid){
        List<DesignContentsLibrary> specialitysLs = finAllSpecialitys();

        for (DesignContentsLibrary speciality : specialitysLs) {
            if( Lang.equals(pid, speciality.getPid()) && Lang.equals(code, speciality.getCode())){
                return  speciality ;
            }
        }
        return null ;
    }


    public static DesignContentsLibrary findItem(String code , String pid){
        List<DesignContentsLibrary> itemLs  = finAllItems() ;
        /*
         * Example :
         * 专业：              机械_铁路("13","1","机械","机","综合检测与维修、工务有关设施、客货运机械设备及其他","machine"),
         * 设计内容:   防护门("1","1-13","防护门","防护门","防护门","trafficengineering")
         *
         */
        for (DesignContentsLibrary item : itemLs) {
            if( Lang.equals(pid,  item.getPid()) && Lang.equals(code,  item.getCode())){
                return item ;
            }
        }
        return null ;
    }

    /*********************************************************************************************************/


    public String getCode() {
        return code;
    }

    public String getPid() {
        return pid;
    }

    public String getName() {
        return name;
    }

    public String getAbbreviation() {
        return abbreviation;
    }

    public String getContent() {
        return content;
    }

    public String getEnglishName() {
        return englishName;
    }

}
